package com.school.sys.login.service;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.school.sys.login.dao.AccountDAO;
import com.school.sys.login.entity.Account;

@Service
public class AccountServiceImpl implements AccountService {
	@Resource
	private AccountDAO adao;
	
	@Override
	public Boolean loginIn(Account account) {
		boolean rs = false;
		try{
			rs = adao.findByProperty(account)==null?false:true;
		}catch(Exception ex){
			ex.printStackTrace();
		}
		return rs;
	}
	
	@Override
	@Transactional(readOnly=false)
	public Boolean addAccount(Account account){
		boolean rs = false;
		try{
			adao.persist(account);
			rs = true;
		}catch(Exception ex){
			ex.printStackTrace();
		}
		return rs;
	}

}
